<?php 
	$config 		= new Zendvn_Controller_Config(array('module'=>'admin',
											'fileConfig'=>'product-category.ini'));
	$itemConfig 	= $config->getconfig('item');
	
	$filter 		= new Zendvn_Filter_Filter();
	$categoryName 	= Zendvn_Filter_Filter::filterContent($this->categoryInfo['name'], 'filter');
	
	$tlbItem		= new Zendvn_Model_Table_Product();
	$arrItem		= $tlbItem->listItem($this->arrParam, array('task' => 'index-product'));
	
?>	
	<div class="latest_product">
	<?php 
 	if(!empty($arrItem)):
 		$i = 0;
 		foreach ($arrItem as $k => $v):
 			$i++;
 			$stylePrice = '';	
	 		$id			= $v['id'];
	 		$cat_id		= $v['cat_id'];
	 		$name 		= Zendvn_Filter_Filter::filterContent($v['name'], 'filter');
	 		$price 		= $v['price'];
	 		$sell_off	= $v['sale_price'];
	 		
	 		$newPrice 	= (empty($sell_off) || $sell_off == 0)?$price:$sell_off;
	 		
	 		$picture 	= $v['image'];
	 		if(file_exists($itemConfig['uploadDir'] . '/' . $picture) && !empty($picture)){
	 			$picture = $itemConfig['uploadUrl'] . '/' . $picture;
	 		}else{
	 			$picture = FILE_URL . '/no-image.png';
	 		}
	 			
	 		$lastProduct = ($i%4 == 0)?' last':'';
	 		
	 		$linkProduct = $this->cmsUrl(array(
							 				'module' => 'default',
							 				'controller' => 'index',
							 				'action' => 'product-detail',
	 										'cat_id' => $cat_id,
							 				'id' => $id,
							 				'title' => $filter->filter($name)
							 		), 'product-detail');
			$linkOrder = $this->cmsUrl(array(
									'module' => 'default',
									'controller' => 'index',
									'action' => 'order',
									'product_id' => $id
									));				 		

 		
 	?>
     	<div class="lev<?php echo $lastProduct?>">
         	<div class="product_name">
           		<a href="<?php echo $linkProduct?>"><?php echo $name?></a>
         	</div>
         	<div class="product_img">
              	<a href="<?php echo $linkProduct?>"><img src="<?php echo $picture?>" alt="maxx99" title="<?php echo $name?>" /></a>
         	</div>	
        	<div class="product_info">
               	<div class="price">
               		<?php if(!empty($sell_off) || $sell_off != 0):?>   
                  	<span class="normal-price"><?php echo number_format($price)?></span>
                  	<?php else: $stylePrice = ' style="margin-top: 25px;"'; endif;?>
                	<span class="special-price"<?php echo $stylePrice?>><?php echo number_format($newPrice)?></span>
               	</div>
              	<div class="button">
	              	<a href="<?php echo $linkOrder?>" onclick="return fancyBox(this)">Đặt hàng</a>
            	</div>
         	</div>
         	<?php if(!empty($sell_off) || $sell_off != 0):?>   
         	<span class="sale_icon"></span>
         	<?php endif;?>
      	</div>
    <?php endforeach;?>
 	</div>
 	<?php endif;?>